<template>
  <div class="app" @click="$emit('myLike',obj.dogName)">
    <img :src="obj.dogImgUrl" alt="" />
    <p @click="fn" :style="{ backgroundColor: color }">{{ obj.dogName }}</p>
    
  </div>
  
</template>

<script>
export default {
  props: {
    obj: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      color: "",
    };
  },

  created() {},

  methods: {
    fn() {
      this.color = `rgb(${Math.floor(Math.random() * 256)},${Math.floor(
        Math.random() * 256
      )},${Math.floor(Math.random() * 256)})`;
    },
  },
};
</script>

<style scoped>
.app {
  width: 200px;
  border: 1px solid black;
  text-align: center;
  float: left;
}
.app img {
  width: 100%;
  height: 150px;
}
</style>
